package com.lcf.app.basic.listener;

import com.lcf.app.basic.model.User;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ChenFei
 * @date 2021/11/11
 */
@RestController
@RequestMapping("event")
public class EventController {

    @Resource
    private ApplicationEventPublisher eventPublisher;

    @GetMapping("init")
    public String init() {
        eventPublisher.publishEvent(new User("ZhangSan", 18, "110"));
        return "SUCCESS";
    }
}
